package com.mycat.chat.two.ui.friend;

import com.mycat.chat.two.util.Constants;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.awt.*;

/**
 * 好友列表节点
 *
 * @author roger.
 * @email 190642964@qq.com
 * @create 2017-02-21
 */
public class FriendNode extends DefaultMutableTreeNode {
    public Icon icon;
    public JLabel picture;
    public JLabel nickNameLabel;
    public JLabel descript;
    public JPanel userContent = new JPanel();

    public FriendNode(Icon icon, String nickName, String signature) {
        super();
        this.icon = icon;

        userContent.setLayout(null);
        userContent.setBackground(Color.WHITE);
        userContent.setPreferredSize(new Dimension(300, 50));

        picture = new JLabel();
        userContent.add(picture);
        picture.setIcon(icon);
        picture.setBounds(8, 4, 39, 42);

        nickNameLabel = new JLabel();
        userContent.add(nickNameLabel);
        nickNameLabel.setFont(Constants.BASIC_FONT);
        nickNameLabel.setText(nickName);
        nickNameLabel.setBounds(59, 5, 132, 19);

        descript = new JLabel();
        userContent.add(descript);
        descript.setFont(Constants.BASIC_FONT);
        descript.setText(signature);
        descript.setBounds(59, 28, 132, 17);
    }

    public Component getView() {
        return userContent;
    }

    public Icon getIcon() {
        return icon;
    }

    public void setIcon(Icon icon) {
        this.icon = icon;
    }

}
